package cn.iocoder.yudao.module.call.dal.mysql.billrecord;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.call.controller.admin.billrecord.vo.BillRecordPageReqVO;
import cn.iocoder.yudao.module.call.dal.dataobject.billrecord.BillRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 消费记录 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface BillRecordMapper extends BaseMapperX<BillRecordDO> {

    default PageResult<BillRecordDO> selectPage(BillRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BillRecordDO>()
                .eqIfPresent(BillRecordDO::getAmount, reqVO.getAmount())
                .eqIfPresent(BillRecordDO::getType, reqVO.getType())
                .eqIfPresent(BillRecordDO::getOwnerUserId, reqVO.getOwnerUserId())
                .betweenIfPresent(BillRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BillRecordDO::getId));
    }

}